/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package at.fhj.itm.refactor.report;

import java.util.Collections;
import java.util.List;

/**
 *
 * @author gerhard
 */
public class RefactoringReport {

    private List<ReportItem> reportItems;

    public RefactoringReport(List<ReportItem> items){
        reportItems = items;
        Collections.sort(reportItems);
    }

    public List<ReportItem> getReportItems(){
        return Collections.unmodifiableList(reportItems);
    }

    public boolean isRefactoringValid(){
        for(ReportItem item : reportItems){
            if(item.getServerity().weight >= ReportSeverity.ERROR.weight){
                return false;
            }
        }
        return true;
    }

    public boolean hasWarnings(){
           for(ReportItem item : reportItems){
            if(item.getServerity() == ReportSeverity.WARNING){
                return true;
            }
        }
        return false;
    }



}
